import request from '@/utils/request'

// 查询订单列表
export function listOrders(query) {
  return request({
    url: '/system/orders/list',
    method: 'get',
    params: query
  })
}

// 查询订单详细
export function getOrders(orderId) {
  return request({
    url: '/system/orders/' + orderId,
    method: 'get'
  })
}

// 新增订单
export function addOrders(data) {
  return request({
    url: '/system/orders',
    method: 'post',
    data: data
  })
}

// 修改订单
export function updateOrders(data) {
  return request({
    url: '/system/orders',
    method: 'put',
    data: data
  })
}

// 删除订单
export function delOrders(orderId) {
  return request({
    url: '/system/orders/' + orderId,
    method: 'delete'
  })
}

// 接受订单
export function receiveOrder(id) {
  return request({
    url: '/system/orders/receiveOrder/'+id,
    method: 'get',
  })
}

// 拒绝订单
export function refuseOrder(id) {
  return request({
    url: '/system/orders/refuseOrder/'+id,
    method: 'get',
  })
}
// 出餐订单
export function dispatchOrder(id) {
  return request({
    url: '/system/orders/dispatchOrder/'+id,
    method: 'get',
  })
}
// 订单已取货
export function pickOrder(id) {
  return request({
    url: '/system/orders/pickOrder/'+id,
    method: 'get',
  })
}
// 订单完成配送
export function finishOrder(id) {
  return request({
    url: '/system/orders/finishOrder/'+id,
    method: 'get',
  })
}
// 订单转接配送
export function transferOrder(id) {
  return request({
    url: '/system/orders/transferOrder/'+id,
    method: 'get',
  })
}
// 统计
export function todayOrder() {
  return request({
    url: '/system/orders/todayOrder',
    method: 'get',
  })
}
